import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.Iterator;
import java.util.Vector;
import java.util.Collection;

class VectorMap implements Map
{
    static class Entry
    {
        Entry(Object key, Object value)
        {
            this.key = key;
            this.value = value;
        }
        
        public String toString()
        {
            return "[" + key.toString() + ": " + value.toString() + "]";
        }

        Object key, value;
    }
    
    public void clear()
    {
        v.clear();
    }
    
    public boolean containsKey(Object key)
    {
        Entry entry = getEntry(key);
        if (entry != null)
        {
            return true;
        }
        return false;
    }
    
    public boolean containsValue(Object value)
    {
        for (Iterator iter = v.iterator(); iter.hasNext(); )
        {
            Entry entry = (Entry)iter.next();
            if (entry.value.equals(value))
            {
                return true;
            }
        }
        
        return false;
    }
    
    public Set entrySet()
    {
        Set result = new TreeSet();
        for (Iterator iter = v.iterator(); iter.hasNext(); )
        {
            Entry entry = (Entry)iter.next();
            result.add(entry);
        }
        return result;
    }

    public boolean equals(Object o)
    {
        return v.equals(o);
    }
    
    private Entry getEntry(Object key)
    {
        for (Iterator iter = v.iterator(); iter.hasNext(); )
        {
            Entry entry = (Entry)iter.next();
            if (entry.key.equals(key))
            {
                return entry;
            }
        }
        
        return null;
    }


    public Object get(Object key)
    {
        Entry entry = getEntry(key);
        if (entry != null)
        {
            return entry.value;
        }
        return null;
    }

    public int hashCode()
    {
        return v.hashCode();
    }
    
    public boolean isEmpty()
    {
        return v.isEmpty();
    }

    public Set keySet()
    {
        Set result = new TreeSet();
        for (Iterator iter = v.iterator(); iter.hasNext(); )
        {
            Entry entry = (Entry)iter.next();
            result.add(entry.key);
        }
        return result;
    }
    
    public Object put(Object key, Object value)
    {
        Entry entry = getEntry(key);
        if (entry != null)
        {
            entry.value = value;
        }
        else
        {
            entry = new Entry(key, value);
            v.add(entry);
        }
        return entry;
    }

    public void putAll(Map m) {}
    public Object remove(Object key) {return null;}
    
    public int size()
    {
        return v.size();
    }

    public Collection values()
    {
        Vector result = new Vector();
        for (Iterator iter = v.iterator(); iter.hasNext(); )
        {
            Entry entry = (Entry)iter.next();
            result.add(entry.value);
        }
        return result;
    }

    public String toString()
    {
        String s = "{";
        for (Iterator iter = v.iterator(); iter.hasNext(); )
        {
            Entry entry = (Entry)iter.next();
            s += entry.toString();
            if (iter.hasNext())
            {
                s += ",";
            }
        }
        s = s + "}";
        return s;
    }

    private Vector v = new Vector();
}
